package cn.getech.data.development.service;


import cn.getech.data.development.config.properties.OozieConfig;
import cn.getech.data.development.dto.JobInfoDto;
import cn.getech.data.development.entity.JobInfo;
import cn.getech.data.development.entity.WorkFlowDep;
import cn.getech.data.development.entity.WorkMenu;
import cn.getech.data.development.model.vo.JobInfoDevOpsVO;
import cn.getech.data.development.model.vo.SumOverViewVO;
import cn.getech.data.development.utils.oozie.JobUtil;
import cn.getech.data.intelligence.common.utils.PageUtils;
import cn.getech.system.center.model.dto.SysUserDto;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * 任务信息表 服务类
 * </p>
 *
 * @author zenith
 * @since 2018-08-23
 */
public interface JobInfoService extends IService<JobInfo> {
    PageUtils queryPage(Map<String, Object> params);

    boolean checkIfRef(Integer id);

    boolean checkExistById(Integer id);

    boolean checkPermission(Integer id);

    boolean checkIsRun(Integer id);

    boolean checkExistByNameAndProcId(String name, Integer procId);

    /**
     * @Description 验证job的状态
     * @Author hujz
     * @Date 2019/8/9 15:21
     * @Param jobId jobid
     * @Return
     * @Exception
     */
    boolean checkJobIsEable(Integer jobId);

    void deleteAllOfJob(Integer jobInfoId, Long userId) throws Exception;

    /**
     * @Description 停止任务
     * @Author hujz
     * @Date 2019/12/25 11:26
     * @Param 任务信息
     * @Return
     * @Exception
     */
    void stopJobInfo(Integer jobId, String oozieJobId) throws Exception;

    List<SysUserDto> getJobOwnersList(Integer procId);

    /**
     * 获取项目下的所有任务
     */
    List<Integer> selectJobIdsByProcId(Integer procId);

    /**
     * 获取用户授权项目下所有任务
     *
     * @return
     */
    List<Integer> selectJobIds();

    List<Integer> selectProcIds();

    List<JobInfoDto> selectListByIds(Set<Integer> jobIds);

    List<JobInfoDto> listAllNodeList(Set<Integer> nodeIds);

    void stopAllJobAndJobNodeHistory(Integer jobId, String lastOozieJobId, String lastCorOozieJobId);

    SumOverViewVO selectSumOverView();

	List<JobInfoDevOpsVO> changeBeans(List<WorkMenu> list);

    void updateBatch(List<Long> ids,Integer userId);

    void stopAutoJob(Integer jobId);

    void updateStatus(Integer jobInfoId);

    void stopJob(Integer jobId, String lastOozieJobId);
}
